package com.yiyuan.weixin.utils;

import com.yiyuan.weixin.weixinOutservice.Iml.ImlAccessToken;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * Created by yserver on 2017/3/31.
 */
public class U {
    public static void getToken(){
        Runnable runnable = new Runnable() {
            public void run() {
               new ImlAccessToken().getAccessToken();
            }
        };
        ScheduledExecutorService service = Executors
                .newSingleThreadScheduledExecutor();
        // 第二个参数为首次执行的延时时间，第三个参数为定时执行的间隔时间
        service.scheduleAtFixedRate(runnable, 10, 7200, TimeUnit.SECONDS);
    }
}
